<%@tag pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@attribute name="item" required="true" type="cn.livingCloud.dto.CaseDto" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>

<td>
    ${item.creator.nickname}
</td>
<td>
    <span class="label label-default">${item.createDateTime}</span>
</td>
<td>
    <c:if test="${not empty item.caseCategoryDto.name}">
        <button type="button" class="btn btn-info btn-xs" data-container="body" data-toggle="popover"
                data-placement="right"
                data-content="${item.caseCategoryDto.name}">
            <span class="fa fa-info-circle"></span>
        </button>
        ${item.caseCategoryDto.shortName}
    </c:if>
</td>
<td>
    ${item.phone}
</td>
<td>
    <button type="button" class="btn btn-info ShowContent" url="content.htm?uuid=${item.uuid}" data-toggle="modal"
            data-target="#myModal">
        查看位置
    </button>
</td>
<td>
    <c:if test="${item.status eq 'FINISH'}">
        <span class="label label-success">${item.status.label}</span>
    </c:if>
    <c:if test="${item.status eq 'ASSIGNMENT'}">
        <span class="label label-info">${item.status.label}</span>
    </c:if>
    <c:if test="${item.status eq 'REPORT'}">
        <span class="label label-primary">${item.status.label}</span>
    </c:if>
    <c:if test="${item.status eq 'NO_HANDLE'}">
        <span class="label label-warning">${item.status.label}</span>
    </c:if>
    <c:if test="${item.status eq 'CANCELLED'}">
        <span class="label label-danger">${item.status.label}</span>
    </c:if>
    <c:if test="${item.status eq 'PENDING'}">
        <span class="label label-danger">${item.status.label}</span>
    </c:if>
    <c:if test="${item.status eq 'LOCK'}">
        <span class="label label-danger">${item.status.label}</span>
    </c:if>
</td>
<td>
    <c:forEach items="${item.ownerList}" var="owner">
        <span class="label label-info">${owner.name}</span>
    </c:forEach>
</td>
<td>
    <div class="btn-group mr5">
        <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
            操作 <span class="caret"></span>
        </button>
        <ul class="dropdown-menu" role="menu">
            <li><a href="info.htm?uuid=${item.uuid}">详情</a></li>
            <li><a href="comments.htm?uuid=${item.uuid}">留言</a></li>
            <li><a href="images.htm?uuid=${item.uuid}">图片</a></li>
            <li><a href="records.htm?uuid=${item.uuid}">档案</a></li>
            <c:if test="${not item.status.finish and not item.status.cancelled and not item.status.pending and not item.status.lock}">
                <li class="divider"></li>
                <shiro:hasPermission name="CMC_REPORT:*">
                    <c:if test="${not item.disableStatus.report}">
                        <li><a href="#" class="loadModal" url="report?uuid=${item.uuid}" data-toggle="modal"
                               data-target="#myModal">上报案件</a></li>
                    </c:if>
                </shiro:hasPermission>
                <shiro:hasPermission name="CMC_CANCEL:*">
                    <li><a href="#" class="loadModal" url="cancel?uuid=${item.uuid}" data-toggle="modal"
                           data-target="#myModal">作废案件</a></li>
                </shiro:hasPermission>
                <shiro:hasPermission name="CMC_ASSIGNMENT:*">
                    <c:if test="${sessionScope.employee.leader or not empty sessionScope.user}">
                        <li><a href="#" class="loadModal" url="assignment?caseUuid=${item.uuid}" data-toggle="modal"
                               data-target="#myModal">分派案件</a></li>
                    </c:if>
                </shiro:hasPermission>
                <shiro:hasPermission name="CMC_FINISH:*">
                    <li><a href="#" class="loadModal" url="finish?uuid=${item.uuid}" data-toggle="modal"
                           data-target="#myModal">完成案件</a></li>
                </shiro:hasPermission>
            </c:if>
            <shiro:hasPermission name="CMC_CASE_REVIEWED:*">
                <c:if test="${item.status.pending}">
                    <li class="divider"></li>
                    <li><a href="#" class="loadModal" url="pending?uuid=${item.uuid}" data-toggle="modal"
                           data-target="#myModal">审核案件</a></li>
                </c:if>
            </shiro:hasPermission>
        </ul>
    </div>
</td>


